package com.bmd.backgroundmanger.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

/**
 * 题目实体类 - 支持多种题型
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("questions")
@Schema(name = "Question", description = "题目实体类")
@ContentRowHeight(18)//内容行高
@HeadRowHeight(25)//标题行高
@ColumnWidth(20)//列宽
public class Question implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "题目ID")
    @TableId(value = "question_id", type = IdType.AUTO)
    @ExcelProperty(value = "题目ID", index = 0)
    private Integer questionId;

    @Schema(description = "题目标题")
    @ExcelProperty(value = "题目标题", index = 1)
    @ColumnWidth(30)
    private String title;

    @Schema(description = "题目内容")
    @ExcelProperty(value = "题目内容", index = 2)
    @ColumnWidth(60)
    private String content;

    @Schema(description = "题目类型：single-单选、multiple-多选、judge-判断、essay-简答")
    @ExcelProperty(value = "题目类型", index = 3)
    private String questionType;

    @Schema(description = "难度级别")
    @ExcelProperty(value = "难度级别", index = 4)
    private String difficultyLevel;

    @Schema(description = "分类ID")
    @ExcelProperty(value = "分类ID", index = 5)
    private Integer categoryId;

    @Schema(description = "正确答案")
    @ExcelProperty(value = "正确答案", index = 6)
    @ColumnWidth(40)
    private String correctAnswer;

    @Schema(description = "题目解析")
    @ExcelProperty(value = "题目解析", index = 7)
    @ColumnWidth(50)
    private String analysis;

    @Schema(description = "题目分值")
    @ExcelProperty(value = "题目分值", index = 8)
    private Integer score;

    @Schema(description = "题目选项(JSON格式)")
    @TableField(typeHandler = JacksonTypeHandler.class)
    @ExcelIgnore
    private List<QuestionOption> options;

    @Schema(description = "创建人")
    @ExcelIgnore
    private Integer createBy;

    @Schema(description = "创建时间")
    @ExcelProperty(value = "创建时间", index = 9)
    private LocalDateTime createTime;

    @Schema(description = "修改人")
    @ExcelIgnore
    private Integer updateBy;

    @Schema(description = "修改时间")
    @ExcelIgnore
    private LocalDateTime updateTime;

    @Schema(description = "分类名称")
    @TableField(exist = false)
    @ExcelIgnore
    private String categoryName;
} 